Skip to content

Auto-detect native transport by default when its library is available - #2216

Open
hyperxpro wants to merge 3 commits into
mainfrom
native-transport-auto-detect
Open

Auto-detect native transport by default when its library is available#2216
hyperxpro wants to merge 3 commits into
mainfrom
native-transport-auto-detect

Conversation

@hyperxpro

Copy link
Copy Markdown
Member

Motivation:

AHC defaulted to NIO and only used epoll/io_uring when an app explicitly called setUseNativeTransport(true), so Linux apps that had the native library on the classpath but didn't set the flag silently ran on the slower NIO transport.

Modification:

When neither useNativeTransport nor a custom EventLoopGroup is set, auto-select a native transport (io_uring/epoll on Linux, kqueue on macOS) if its library is present, otherwise NIO, with no warning. The explicit setUseNativeTransport(true) path keeps A4's warn-and-fallback. Force NIO with -Dio.netty.transport.noNative=true.

Result:

Native transport is used out of the box wherever its library is available.

@hyperxpro
hyperxpro force-pushed the native-transport-auto-detect branch 5 times, most recently from 665b215 to 4a85394 Compare August 2, 2026 13:57
hyperxpro added a commit that referenced this pull request Aug 2, 2026
… io_uring fallback

Fixes for PR #2216 CI failures on io_uring:
- InputStreamMultipartPart: prevent infinite loop with slowTarget backpressure
- StackTraceInspector: detect native transport connection resets via errno matching
- NettyChannelConnector: annotate connect failures with host:port for io_uring
- ChannelManager: fallback from io_uring to epoll on ring allocation failure
  (io_uring rings charge against RLIMIT_MEMLOCK, not always available)

Rebased on #2288 (Fix per-host connection permit leak) for proper semaphore handling.
hyperxpro added a commit that referenced this pull request Aug 2, 2026
… io_uring fallback

Fixes for PR #2216 CI failures on io_uring:
- InputStreamMultipartPart: prevent infinite loop with slowTarget backpressure
- StackTraceInspector: detect native transport connection resets via errno matching
- NettyChannelConnector: annotate connect failures with host:port for io_uring
- ChannelManager: fallback from io_uring to epoll on ring allocation failure
  (io_uring rings charge against RLIMIT_MEMLOCK, not always available)

Rebased on #2288 (Fix per-host connection permit leak) for proper semaphore handling.
@hyperxpro
hyperxpro force-pushed the native-transport-auto-detect branch from 4a85394 to a6b7357 Compare August 2, 2026 14:00
hyperxpro added a commit that referenced this pull request Aug 2, 2026
… io_uring fallback

Fixes for PR #2216 CI failures on io_uring:
- InputStreamMultipartPart: prevent infinite loop with slowTarget backpressure
- StackTraceInspector: detect native transport connection resets via errno matching
- NettyChannelConnector: annotate connect failures with host:port for io_uring
- ChannelManager: fallback from io_uring to epoll on ring allocation failure
  (io_uring rings charge against RLIMIT_MEMLOCK, not always available)

Rebased on #2288 (Fix per-host connection permit leak) for proper semaphore handling.
@hyperxpro
hyperxpro force-pushed the native-transport-auto-detect branch from a6b7357 to d223fcb Compare August 2, 2026 14:04
… io_uring fallback

Fixes for PR #2216 CI failures on io_uring:
- InputStreamMultipartPart: prevent infinite loop with slowTarget backpressure
- StackTraceInspector: detect native transport connection resets via errno matching
- NettyChannelConnector: annotate connect failures with host:port for io_uring
- ChannelManager: fallback from io_uring to epoll on ring allocation failure
  (io_uring rings charge against RLIMIT_MEMLOCK, not always available)

Rebased on #2288 (Fix per-host connection permit leak) for proper semaphore handling.
@hyperxpro
hyperxpro force-pushed the native-transport-auto-detect branch from d223fcb to 0e31b49 Compare August 2, 2026 15:21
C1: InputStreamMultipartPart - restore position check to prevent hang on
    streams that don't EOF after declared length (socket-backed, etc)

C2: annotateConnectException - preserve ConnectException type to avoid
    breaking retry predicates that key on ClosedChannelException or
    SslHandler.disconnect stack frames
@hyperxpro
hyperxpro force-pushed the native-transport-auto-detect branch from 1181c12 to c9326b5 Compare August 2, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant